package com.copa.gameStore.exception;

import com.copa.gameStore.vo.ResponseVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;


@Slf4j
@RestController
public class HttpErrorController implements ErrorController {

    private final static String ERROR_PATH = "/error";

    @ResponseBody
    @RequestMapping(path  = ERROR_PATH )
    public ResponseVo<String> error(){
        log.info("访问/error" + "  错误" );
        return ResponseVo.errorMsg("访问/error, 错误");
    }

    @Override
    public String getErrorPath() {
        return ERROR_PATH;
    }
}